#ifndef _MEMCACHE_MEM_SLABS_H_
#define _MEMCACHE_MEM_SLABS_H_

class Chunk {
    Chunk* _next_chunk;
    uint8_t _slab_id;
    uint32_t _ref;
    char _data[0];
};

class MemAllocator {
public:
    int init(const size_t limit, int slablimit = 18, int max_item_size = 1024 * 1024, const double factor = 1.2);
    Chunk* slabs_allocate(const size_t size);
    void slabs_deallocate(Chunk *buf);
private:
    std::vector<SlabClass> _slabClass;
    MemPool* _pool;
    const static int _chunk_align_bytes = 8;
};

#endif
